﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using MarkControle.Models;

namespace MarkControle.ActionFilters
{
    public class LoginFilter : ActionFilterAttribute
    {
        public override void OnActionExecuting(ActionExecutingContext filtersContext)
        {
            Login user = (Login)filtersContext.HttpContext.Session["login"];

            if (user != null)
            {
                base.OnActionExecuting(filtersContext);
            }
            else
            {
                filtersContext.HttpContext.Response.Redirect("/Login/ViewPage");
            }
        }
    }
}